﻿using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

// Token: 0x020002F6 RID: 758
public class PauseMenue : MonoBehaviour
{
	// Token: 0x170001CA RID: 458
	// (get) Token: 0x06001362 RID: 4962 RVA: 0x0008B44C File Offset: 0x0008964C
	// (set) Token: 0x06001363 RID: 4963 RVA: 0x0008B460 File Offset: 0x00089660
	public bool EnableConfig
	{
		get
		{
			return this.buttonConfig.gameObject.activeSelf;
		}
		set
		{
			this.buttonConfig.gameObject.SetActive(value);
		}
	}

	// Token: 0x170001CB RID: 459
	// (get) Token: 0x06001364 RID: 4964 RVA: 0x0008B474 File Offset: 0x00089674
	// (set) Token: 0x06001365 RID: 4965 RVA: 0x0008B488 File Offset: 0x00089688
	public bool EnableTitle
	{
		get
		{
			return this.buttonTitle.gameObject.activeSelf;
		}
		set
		{
			this.buttonTitle.gameObject.SetActive(value);
		}
	}

	// Token: 0x170001CC RID: 460
	// (get) Token: 0x06001366 RID: 4966 RVA: 0x0008B49C File Offset: 0x0008969C
	public bool IsOpen
	{
		get
		{
			return this.canvas.enabled;
		}
	}

	// Token: 0x06001367 RID: 4967 RVA: 0x0008B4AC File Offset: 0x000896AC
	private void Awake()
	{
		this.gameCtrl = UnityEngine.Object.FindObjectOfType<GameControl>();
		this.buttonConfig.onClick.AddListener(new UnityAction(this.OnClick_Config));
		this.buttonTitle.onClick.AddListener(new UnityAction(this.OnClick_Title));
		this.buttonExit.onClick.AddListener(new UnityAction(this.OnClick_Exit));
		this.buttonClose.onClick.AddListener(new UnityAction(this.OnClick_Close));
		this.canvas.enabled = false;
	}

	// Token: 0x06001368 RID: 4968 RVA: 0x0008B540 File Offset: 0x00089740
	public void Setup(bool enableConfig, bool enableTitle, Action openConfig, Action titleAct, Action exitAct)
	{
		this.openConfig = openConfig;
		this.titleAct = titleAct;
		this.exitAct = exitAct;
		this.buttonConfig.gameObject.SetActive(enableConfig);
		this.buttonTitle.gameObject.SetActive(enableTitle);
	}

	// Token: 0x06001369 RID: 4969 RVA: 0x0008B57C File Offset: 0x0008977C
	private void Update()
	{
		if (Input.GetKeyDown(KeyCode.Escape) && !this.gameCtrl.IsActiveModalUI)
		{
			if (this.IsOpen)
			{
				this.Close();
			}
			else
			{
				this.Open();
			}
		}
		if (Input.GetKeyDown(KeyCode.F1) && !this.gameCtrl.IsActiveModalUI && this.EnableConfig)
		{
			this.openConfig();
		}
	}

	// Token: 0x0600136A RID: 4970 RVA: 0x0008B5F8 File Offset: 0x000897F8
	public void Open()
	{
		this.gameCtrl.audioCtrl.Play2DSE(this.gameCtrl.audioCtrl.systemSE_open);
		this.canvas.enabled = true;
	}

	// Token: 0x0600136B RID: 4971 RVA: 0x0008B628 File Offset: 0x00089828
	public void Close()
	{
		this.gameCtrl.audioCtrl.Play2DSE(this.gameCtrl.audioCtrl.systemSE_close);
		this.canvas.enabled = false;
	}

	// Token: 0x0600136C RID: 4972 RVA: 0x0008B658 File Offset: 0x00089858
	private void OnEnable()
	{
	}

	// Token: 0x0600136D RID: 4973 RVA: 0x0008B65C File Offset: 0x0008985C
	private void OnClick_Config()
	{
		if (this.openConfig != null)
		{
			this.canvas.enabled = false;
			this.openConfig();
		}
	}

	// Token: 0x0600136E RID: 4974 RVA: 0x0008B680 File Offset: 0x00089880
	private void OnClick_Title()
	{
		if (this.titleAct != null)
		{
			this.titleAct();
		}
		else
		{
			this.gameCtrl.audioCtrl.Play2DSE(this.gameCtrl.audioCtrl.systemSE_choice);
			this.gameCtrl.CreateModalYesNoUI("タイトルへ戻ります。\nよろしいですか？", new Action(this.ToTitle), null);
		}
	}

	// Token: 0x0600136F RID: 4975 RVA: 0x0008B6E8 File Offset: 0x000898E8
	private void ToTitle()
	{
		this.gameCtrl.ChangeScene("TitleScene", string.Empty, 1f);
		this.canvas.enabled = false;
	}

	// Token: 0x06001370 RID: 4976 RVA: 0x0008B710 File Offset: 0x00089910
	private void OnClick_Exit()
	{
		if (this.exitAct != null)
		{
			this.exitAct();
		}
		else
		{
			this.gameCtrl.audioCtrl.Play2DSE(this.gameCtrl.audioCtrl.systemSE_choice);
			this.gameCtrl.CreateModalYesNoUI("ゲームを終了します。\nよろしいですか？", new Action(this.ToExit), null);
		}
	}

	// Token: 0x06001371 RID: 4977 RVA: 0x0008B778 File Offset: 0x00089978
	private void ToExit()
	{
		this.gameCtrl.ChangeScene("ExitScene", string.Empty, 1f);
		this.canvas.enabled = false;
	}

	// Token: 0x06001372 RID: 4978 RVA: 0x0008B7A0 File Offset: 0x000899A0
	private void OnClick_Close()
	{
		this.gameCtrl.audioCtrl.Play2DSE(this.gameCtrl.audioCtrl.systemSE_close);
		this.canvas.enabled = false;
	}

	// Token: 0x0400187B RID: 6267
	private GameControl gameCtrl;

	// Token: 0x0400187C RID: 6268
	[SerializeField]
	private Canvas canvas;

	// Token: 0x0400187D RID: 6269
	[SerializeField]
	private Button buttonConfig;

	// Token: 0x0400187E RID: 6270
	[SerializeField]
	private Button buttonTitle;

	// Token: 0x0400187F RID: 6271
	[SerializeField]
	private Button buttonExit;

	// Token: 0x04001880 RID: 6272
	[SerializeField]
	private Button buttonClose;

	// Token: 0x04001881 RID: 6273
	private Action openConfig;

	// Token: 0x04001882 RID: 6274
	private Action titleAct;

	// Token: 0x04001883 RID: 6275
	private Action exitAct;
}
